Implement Display for KeyCode and KeyModifiers #862
Merged
+354
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Partially addresses #792
In Ratatui apps using Crossterm, something we'd like to be able to generally provide approaches for is help screens that show the key bindings that will be used. The responsibility for displaying each keys properly most likely belongs in Crossterm rather than each application.
I've tried to make some reasonable choices about displaying the keys that match the target platform (e.g. on Mac, Backspace is Delete, Delete is Fwd Del, Enter is Return, Alt is Option, Ctrl is Control, Super is Command, and on Windows Super is the Windows key). These choices are backed by the style guidelines from Apple and Microsoft where possible and intuition where not (e.g. Next Track instead of Track Next).
It would be nice to be able to have used something like
strum
'sDisplay
derive macro to make the implementation of this simple, but there currently isn't a way to make the format for the function keys (F1
) or the media / modifier key variants work with that, so a more manual approach is taken.